# -*- coding: utf-8 -*-
from datetime import timedelta
from utils.operators.cluster_for_spark_sql_operator import SparkSqlOperator
from airflow.operators.dummy_operator import DummyOperator

jms_dwd__dwd_wide_yl_rt_ssmx_bill_detail_hf1 = SparkSqlOperator(
    task_id='jms_dwd__dwd_wide_yl_rt_ssmx_bill_detail_hf1',
    email=['lukunming@jtexpress.com','yl_bigdata@yl-scm.com'],
    master='yarn',
    name='jms_dwd__dwd_wide_yl_rt_ssmx_bill_detail_hf1_{{ execution_date | cst_hour }}',
    sql='jms_hi/dwd/dwd_wide_yl_rt_ssmx_bill_detail_hf/execute1.hql',
    pool_slots=2,
    driver_cores=2,
    driver_memory='4g',
    executor_cores=2,
    executor_memory='8G',
    num_executors=60,
    conf={'spark.dynamicAllocation.enabled'                  : 'true',
          'spark.shuffle.service.enabled'                    : 'true',
          'spark.dynamicAllocation.maxExecutors'             : 80,
          'spark.dynamicAllocation.cachedExecutorIdleTimeout': 600,
          'spark.network.timeout' : 600,
          'spark.sql.sources.partitionOverwriteMode'         : 'dynamic',
          'spark.executor.memoryOverhead'                    : '2G',
          'spark.sql.shuffle.partitions'                     : 720
          },
    hiveconf={'hive.exec.dynamic.partition'             : 'true',  # 动态分区
              'hive.exec.dynamic.partition.mode'        : 'nonstrict',
              'hive.exec.max.dynamic.partitions'        : 3000,  # 最大分区
              'hive.exec.max.dynamic.partitions.pernode': 3000,  # 最大分区
              },
    yarn_queue='pro',
    execution_timeout=timedelta(minutes=50),
    retries=0,
    sla=timedelta(hours=2),)


jms_dwd__dwd_wide_yl_rt_ssmx_bill_detail_hf2 = SparkSqlOperator(
    task_id='jms_dwd__dwd_wide_yl_rt_ssmx_bill_detail_hf2',
    email=['lukunming@jtexpress.com','yl_bigdata@yl-scm.com'],
    master='yarn',
    name='jms_dwd__dwd_wide_yl_rt_ssmx_bill_detail_hf2_{{ execution_date | cst_hour }}',
    sql='jms_hi/dwd/dwd_wide_yl_rt_ssmx_bill_detail_hf/execute2.hql',
    pool_slots=2,
    driver_cores=2,
    driver_memory='4g',
    executor_cores=2,
    executor_memory='8G',
    num_executors=60,
    conf={'spark.dynamicAllocation.enabled'                  : 'true',
          'spark.shuffle.service.enabled'                    : 'true',
          'spark.dynamicAllocation.maxExecutors'             : 80,
          'spark.dynamicAllocation.cachedExecutorIdleTimeout': 600,
          'spark.network.timeout' : 600,
          'spark.sql.sources.partitionOverwriteMode'         : 'dynamic',
          'spark.executor.memoryOverhead'                    : '2G',
          'spark.sql.shuffle.partitions'                     : 720
          },
    hiveconf={'hive.exec.dynamic.partition'             : 'true',  # 动态分区
              'hive.exec.dynamic.partition.mode'        : 'nonstrict',
              'hive.exec.max.dynamic.partitions'        : 3000,  # 最大分区
              'hive.exec.max.dynamic.partitions.pernode': 3000,  # 最大分区
              },
    yarn_queue='pro',
    execution_timeout=timedelta(minutes=50),
    retries=0,
    sla=timedelta(hours=2),)
jms_dwd__dwd_wide_yl_rt_ssmx_bill_detail_hf2 << jms_dwd__dwd_wide_yl_rt_ssmx_bill_detail_hf1


jms_dwd__dwd_wide_yl_rt_ssmx_bill_detail_hf = DummyOperator(
    task_id='jms_dwd__dwd_wide_yl_rt_ssmx_bill_detail_hf',
    email=['lukunming@jtexpress.com','yl_bigdata@yl-scm.com'],
    retries=0,
    priority_weight=0
)

jms_dwd__dwd_wide_yl_rt_ssmx_bill_detail_hf << jms_dwd__dwd_wide_yl_rt_ssmx_bill_detail_hf2,





